package com.blog.util.uuid;

import java.util.UUID;

/**
 * @author cgx
 * @Date 2021/8/14 21:32
 *
 * uuid工具类
 */
public class UUIDUtils {


    /**
     * 获取uid
     * @param
     * @return
     */
    public static String getUUId(){
        //生成的uuid中间有-连接，我们需要将其剪切掉    0aeb49b5-2182-42e7-abd7-c777a5c84c6f
        String uuid = UUID.randomUUID().toString().replaceAll("-","");
        return uuid;
    }


    public static String getArticleNum(){
        return getUUId().substring(0,6);
    }


    public static void main(String[] args) {
        String uuId = UUIDUtils.getUUId();
        for (int i = 0; i < 10; i++) {
            System.out.println(UUIDUtils.getUUId());
        }
    }
}
